<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button id="b">天宝大法好</button>
</body>


<script>
    // document.write(显示内容)
    // alert(弹出警告框)
    // onclick(事件会在元素被点击时发生)
    // function (用于声明一个函数)
    document.getElementById("b").onclick = function () {
        alert("门前汽油浇")
    };
    //<script src="../js/myJs.js">
    document.write("<br>");
    //let(声明的变量)
    let name = "张三";
    let age = 23;
    document.write(name + age + "<br>");

    //成员变量
    {
        a = "111";
        b = "222";
    }
    document.write(b);

    //const 不可被更改
    const p = 333;
    document.write(p + "<br>");

    //typeof 判断变量数据类型
    let num = 18;
    document.write(typeof (num) + "<br>");

    //数组长度可变
    let z = [1, 2, 3];
    for (let i = 0; i < z.length; i++) {
        document.write(z[i]);
    }
    document.write("<br>")
    z[5] = 5;
    document.write(z);
    /*
        for (let i = 1; i <= 3; i++) {
            document.write(i)
        }
    */


</script>

</html>